/**
 * 
 */
package pkgTriangle;

//import java.io.Console;

/**
 * @author pandu.masabathula
 *
 */
public class clsTriangle {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		GetTriangleType(5,4,3);
	}
	
	private static void GetTriangleType(double side1, double side2, double side3)
	{
		if (side1 <=0 || side2 <= 0 || side3 <= 0)
		{
			System.out.println("Invalid data provided.");
			return;
		}
		if ((side1+side2 > side3) && (side2+side3 > side1) && (side3+side1 > side2))
		{
			if ((side1 == side2) && (side2 == side3) && (side3 == side1)) //Checking for Equilateral Triangle
			{
				System.out.println("Triangle is Equilateral.");
			}
			else if ((side1 == side2) || (side2 == side3) || (side3 == side1)) //checking for Isosceles Triangle
			{
					System.out.println("Triangle is Isosceles");
			}
			else if ((side1 != side2) && (side2 != side3) && (side3 != side1)) //Checking for Scalene or Right Triangle
			{
				if (
						(side1 > side2 
							&& (side2 > side3  || side3 > side2)
							&& (Math.pow(side2,2)+Math.pow(side3,2) == Math.pow(side1,2))) 
						||
						(side2 > side3 
							&& (side3 > side1 || side1 > side3) 
							&& (Math.pow(side3,2)+Math.pow(side1,2) == Math.pow(side2,2)))
						||
						(side3 > side1 
							&& (side1 > side2 || side2 > side1) 
							&& (Math.pow(side1,2)+Math.pow(side2,2) == Math.pow(side3,2)))
					)
				{
					System.out.println("Triangle is Right triangle.");
				}
				else
				{
					System.out.println("Triangle is Scalene.");
				}
			}
		}
		else
		{
			System.out.println("Cannot form Triangle. Try again.");
		}
	}
	
}
